class School:
    '''类的组合、有关联没有直接关系的类组合在一起'''
    def __init__(self,name,addr):
        self.name=name
        self.addr =addr
class Teacher:
    def __init__(self,name,salary,school):
        self.name = name
        self.salary = salary
        self.school = school
class Coures:
    def __init__(self,name,teacher,school):
        self.name = name
        self.teacher = teacher
        self.school = school
s1 = School("老男孩",'北京沙河')
s2 = School("老男孩",'重庆沙河')
s3 = School("老男孩",'南京沙河')
t1 = Teacher('linhaifeng',30000,s1)
t2 = Teacher('yuhao',30000,s2)
t3 = Teacher('alex',30000,s3)
c1 =Coures('python',t1,s1)
c2 =Coures('C语言',t2,s2)
c3 =Coures('java',t3,s3)
print(t1.__dict__)
print(c1.__dict__)


print(t1.name)
# if __name__=="__mian__":


while True:
    msg = '''
    1.老男孩 北京沙河
    2.老男孩 重庆沙河 
    3.老男孩 南京沙河'''
    print(msg)
    choices =input('>>>选择学校：')
    moue={
        '1':s1,
        '2':s2,
        '3':s3
    }
    schoolobj =moue[choices]
    msg1 = '''
                 1.linhaifeng 
                 2. yuanhao
                 3. alex '''
    print(msg1)
    choicet = input('>>>选择老师：')
    mouet = {
        '1': t1,
        '2': t2,
        '3': t3
    }
    teacherobj = mouet[choicet]
    msg2 = '''
        1.python
        2.C语言
        3.java
        '''
    print(msg2)
    choicec = input('>>>选择课程名：')
    mouec = {
        '1': c1,
        '2': c2,
        '3': c3
    }
    couresobj = mouec[choicec]
    new_course = Coures(couresobj,teacherobj,schoolobj)
    print('选中%s学校的%s老师的%s课程'\
          % (new_course.school.name,new_course.teacher.name,new_course.name.name))